package com.game.fg.service;
import org.java_websocket.WebSocket;

public class FGUser {

    private int uid;//玩家uid
    private int money;//玩家当前金币数量
    private long totalWinLoseScore;//总净分: 输赢分
    private long totalTax; //总税收
    private int dayWinLoseScore;//当天净分: 输赢分
    private int dayTax; //当天税收
    private int dayHelpCoin;//当天补助金
    private String appID;//平台ID
    private int totalOnlineTime; //总在线时长
    private int totalPlayTime;//总游戏时长
    private int dayOnlineTime;//当天在线时长
    private int dayPlayTime;//当天游戏时长

    private int cfgBuyTNum;//配置: 加积分次数
    private int cfgBuyCNum;//配置: 加积分数
    private int cfgSaleTNum;//配置: 扣积分次数
    private int cfgSaleCNum;//配置: 扣积分数
    private int dayBuyTNum; //玩家每日已经加积分次数
    private int dayBuyCNum;//玩家每日已经加积分数
    private int daySaleTNum;//玩家每日已经扣积分次数
    private int daySaleCNum;//玩家每日已经扣积分数

    void setUserInfo(int money, long totalWinLoseScore, long totalTax, int dayWinLoseScore, int dayTax,
                     int dayHelpCoin, String appID, int totalOnlineTime, int totalPlayTime, int dayOnlineTime,
                     int dayPlayTime, int cfgBuyTNum, int cfgBuyCNum, int cfgSaleTNum, int cfgSaleCNum,
                     int dBuyTNum, int dBuyCNum, int dSaleTNum, int dSaleCNum) {
        this.money = money;//玩家当前金币数量
        this.totalWinLoseScore = totalWinLoseScore;//总净分: 输赢分
        this.totalTax = totalTax; //总税收
        this.dayWinLoseScore = dayWinLoseScore;//当天净分: 输赢分
        this.dayTax = dayTax; //当天税收
        this.dayHelpCoin = dayHelpCoin;//当天补助金
        this.appID = appID;//当天补助金
        this.totalOnlineTime = totalOnlineTime;//总在线时长
        this.totalPlayTime = totalPlayTime;//总游戏时长
        this.dayOnlineTime = dayOnlineTime;//当天在线时长
        this.dayPlayTime = dayPlayTime;//当天游戏时长

        this.cfgBuyTNum = cfgBuyTNum;//配置: 加积分次数
        this.cfgBuyCNum = cfgBuyCNum;//配置: 加积分数
        this.cfgSaleTNum = cfgSaleTNum;//配置: 扣积分次数
        this.cfgSaleCNum = cfgSaleCNum;//配置: 扣积分数
        this.dayBuyTNum = dBuyTNum;//加积分次数
        this.dayBuyCNum = dBuyCNum;//加积分数
        this.daySaleTNum = dSaleTNum;//扣积分次数
        this.daySaleCNum = dSaleCNum;//扣积分数

        this.enterGameTime = System.currentTimeMillis() / 1000;//进入游戏的时间
    }

    private WebSocket ws;//web socket链接
    private Message.EnumRoomType roomType;//当前所在的房间类型
    private int round;//当前回合数
    private boolean normal;//是否是非正常安全线
    private double jackpotOfRound0;//第一回合进入奖池的数量
    private double jackpotOfRound1;//第二回合进入奖池的数量
    private double taxRateOfRound0;//第一局抽水率
    private double taxRateOfRound1;//第二局抽水率
    private double benefitsOfRound0;//第一回合进入救济金的数量
    private double benefitsOfRound1;//第二回合进入救济金的数量
    private int canGetMoney;//结束可以获得的金币
    private boolean isHelpWin;//是否是补助操作结果
    private long enterGameTime;//进入游戏的时间戳

    //清除玩家游戏记录
    void clear() {
        roomType = null;
        round = 0;
        jackpotOfRound0 = 0;
        jackpotOfRound1 = 0;
        normal = true;
        benefitsOfRound0 = 0;
        benefitsOfRound1 = 0;
        canGetMoney = 0;
    }

    public int getUid() {
        return uid;
    }

    int getMoney() {
        return money;
    }

    boolean isHelpWin() {
        return isHelpWin;
    }

    void setHelpWin(boolean helpWin) {
        isHelpWin = helpWin;
    }

    //更新玩家当前金币
    void updateMoney(int value, int optSrc) {
        this.money += value;
        AuthServer.getInstance().WriteUserMoney(uid, value, optSrc);
        //MQ日志
        MQServer.getInstance().onMoneyChange(this, value, optSrc);
    }

    public WebSocket getWs() {
        return ws;
    }

    Message.EnumRoomType getRoomType() {
        return roomType;
    }

    void setRoomType(Message.EnumRoomType roomType) {
        this.roomType = roomType;
    }


    int getRound() {
        return round;
    }

    void setRound(int round) {
        this.round = round;
    }

    double getJackpotOfRound0() {
        return jackpotOfRound0;
    }

    void setJackpotOfRound0(double jackpotOfRound0) {
        this.jackpotOfRound0 = jackpotOfRound0;
    }

    double getJackpotOfRound1() {
        return jackpotOfRound1;
    }

    void setJackpotOfRound1(double jackpotOfRound1) {
        this.jackpotOfRound1 = jackpotOfRound1;
    }

    boolean isNormal() {
        return normal;
    }

    void setNormal(boolean normal) {
        this.normal = normal;
    }

    double getTaxRateOfRound0() {
        return taxRateOfRound0;
    }

    void setTaxRateOfRound0(double taxRateOfRound0) {
        this.taxRateOfRound0 = taxRateOfRound0;
    }

    double getTaxRateOfRound1() {
        return taxRateOfRound1;
    }

    void setTaxRateOfRound1(double taxRateOfRound1) {
        this.taxRateOfRound1 = taxRateOfRound1;
    }

    double getBenefitsOfRound0() {
        return benefitsOfRound0;
    }

    void setBenefitsOfRound0(double benefitsOfRound0) {
        this.benefitsOfRound0 = benefitsOfRound0;
    }

    double getBenefitsOfRound1() {
        return benefitsOfRound1;
    }

    void setBenefitsOfRound1(double benefitsOfRound1) {
        this.benefitsOfRound1 = benefitsOfRound1;
    }


    int getCanGetMoney() {
        return canGetMoney;
    }

    void setCanGetMoney(int canGetMoney) {
        this.canGetMoney = canGetMoney;
    }

    long getTotalWinLoseScore() {
        return totalWinLoseScore;
    }

    void setTotalWinLoseScore(long totalWinLoseScore) {
        this.totalWinLoseScore = totalWinLoseScore;
    }

    long getTotalTax() {
        return totalTax;
    }

    public void setTotalTax(long totalTax) {
        this.totalTax = totalTax;
    }

    int getDayWinLoseScore() {
        return dayWinLoseScore;
    }

    void setDayWinLoseScore(int dayWinLoseScore) {
        this.dayWinLoseScore = dayWinLoseScore;
    }

    int getDayTax() {
        return dayTax;
    }

    void setDayTax(int dayTax) {
        this.dayTax = dayTax;
    }

    int getDayHelpCoin() {
        return dayHelpCoin;
    }

    void setDayHelpCoin(int dayHelpCoin) {
        this.dayHelpCoin = dayHelpCoin;
    }

    public void setWs(WebSocket ws) {
        this.ws = ws;
    }

    String getAppID() {
        return appID;
    }

    public int getTotalOnlineTime() {
        return totalOnlineTime;
    }

    void setTotalOnlineTime(int totalOnlineTime) {
        this.totalOnlineTime = totalOnlineTime;
    }

    int getTotalPlayTime() {
        return totalPlayTime;
    }

    void setTotalPlayTime(int totalPlayTime) {
        this.totalPlayTime = totalPlayTime;
    }

    int getDayOnlineTime() {
        return dayOnlineTime;
    }

    void setDayOnlineTime(int dayOnlineTime) {
        this.dayOnlineTime = dayOnlineTime;
    }

    int getDayPlayTime() {
        return dayPlayTime;
    }

    void setDayPlayTime(int dayPlayTime) {
        this.dayPlayTime = dayPlayTime;
    }

    long getEnterGameTime() {
        return enterGameTime;
    }

    public int getCfgBuyTNum() {
        return cfgBuyTNum;
    }

    public void setCfgBuyTNum(int cfgBuyTNum) {
        this.cfgBuyTNum = cfgBuyTNum;
    }

    public int getCfgBuyCNum() {
        return cfgBuyCNum;
    }

    public void setCfgBuyCNum(int cfgBuyCNum) {
        this.cfgBuyCNum = cfgBuyCNum;
    }

    public int getCfgSaleTNum() {
        return cfgSaleTNum;
    }

    public void setCfgSaleTNum(int cfgSaleTNum) {
        this.cfgSaleTNum = cfgSaleTNum;
    }

    public int getCfgSaleCNum() {
        return cfgSaleCNum;
    }

    public void setCfgSaleCNum(int cfgSaleCNum) {
        this.cfgSaleCNum = cfgSaleCNum;
    }

    public int getDayBuyTNum() {
        return dayBuyTNum;
    }

    public void setDayBuyTNum(int dayBuyTNum) {
        this.dayBuyTNum = dayBuyTNum;
    }

    public int getDayBuyCNum() {
        return dayBuyCNum;
    }

    public void setDayBuyCNum(int dayBuyCNum) {
        this.dayBuyCNum = dayBuyCNum;
    }

    public int getDaySaleTNum() {
        return daySaleTNum;
    }

    public void setDaySaleTNum(int daySaleTNum) {
        this.daySaleTNum = daySaleTNum;
    }

    public int getDaySaleCNum() {
        return daySaleCNum;
    }

    public void setDaySaleCNum(int daySaleCNum) {
        this.daySaleCNum = daySaleCNum;
    }


    FGUser(int uid, WebSocket ws) {
        this.uid = uid;
        this.ws = ws;
        roomType = null;
        round = 0;
        jackpotOfRound0 = 0;
        jackpotOfRound1 = 0;
        normal = true;
        money = 0;
        benefitsOfRound0 = 0;
        benefitsOfRound1 = 0;
        canGetMoney = 0;
    }


}
